package com.xlh.support.backup.dao.helper;

import com.xlh.support.backup.dao.BackupMapper;
import com.xlh.support.backup.domain.Backup;
import com.xlh.support.backup.domain.BackupExample;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author cheer
 */
@Repository
public class BackupMapperHelper {

    @Autowired
    private BackupMapper backupMapper;

    public Backup getBackup() {
        BackupExample example = new BackupExample();
        example.or().andDeletedEqualTo(false);
        List<Backup> backups = backupMapper.selectByExample(example);
        if (CollectionUtils.isNotEmpty(backups)) {
            return backups.get(0);
        }
        return null;
    }
}
